package org.yjh.tool;

import org.springframework.stereotype.Component;

import java.util.Date;
import java.util.Random;


public class GetUrl {
    public String getUrl(){
        String str="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
        //生成随机角标【随机生产数去取str字符串的某个索引】
        Random ran = new Random();
        String code="";
        for (int i = 1; i <=3 ; i++) {
            int index =ran.nextInt(str.length());//在长度范围内产生一个随机的数
            char ch = str.charAt(index);//从随机数获取字符
            code += ch;
        }
        Date date = new Date();
        long time = date.getTime();
        String url = code + time;
        return url;
    }
}
